package com.example.academic_affairs_system.controller;

import com.example.academic_affairs_system.common.R;
import com.example.academic_affairs_system.model.dto.studentCourses.StudentCoursesDTO;
import com.example.academic_affairs_system.model.dto.studentCourses.StudentCoursesPageDTO;
import com.example.academic_affairs_system.service.IAasStudentCoursesService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 学生和课表的关联数据，用于登记学生的课程成绩 前端控制器
 *
 * @author hjx
 * @since 2023-01-31
 */
@RestController
@RequestMapping("/sys/studentcourses")
public class AasStudentCoursesController {
  @Resource IAasStudentCoursesService iAasStudentCoursesService;

  @GetMapping("/list")
  public R getClassStudentCourses(StudentCoursesPageDTO dto) {
    return R.ok(iAasStudentCoursesService.getClassStudentCourses(dto));
  }

  @PostMapping("/grades")
  public R grades(@RequestBody StudentCoursesDTO dto) {
    return R.ok(iAasStudentCoursesService.editStudentGrades(dto));
  }
}
